define(['lib/cannon', 'lib/cannondemo', 'lib/three50', 'lib/detector', 'lib/stats', 'lib/datgui'], function() {
    
    var demo = new CANNON.Demo()
    
    demo.addScene(function(app) {
        
        var world = new CANNON.World()
        app.setWorld(world)
        world.broadphase = new CANNON.NaiveBroadphase()
        world.iterations = 60
        
        var groundShape = new CANNON.Plane(new CANNON.Vec3(0,1,0))
        var groundBody = new CANNON.RigidBody(0,groundShape)
        world.add(groundBody)
        app.addVisual(groundBody)
        
        var compoundShape = new CANNON.Compound()
        var size = 1.0,
        shape = new CANNON.Box(new CANNON.Vec3(size*0.5, size*0.5, size*0.5))
        compoundShape.addChild(shape,new CANNON.Vec3(0, 0, 0))
        compoundShape.addChild(shape,new CANNON.Vec3(0, 1, 0))
    
        var mass = 10
        var body = new CANNON.RigidBody(mass, compoundShape)
        body.position.set(0, 0, 6)
        //body.quaternion.set(0, 1, 0, 0.1)
        world.add(body)
        app.addVisual(body)
        
        world.gravity.set(0, -60, 0)
        
    })
    
    demo.start()
    
})